package com.shop.admin.service.impl;

import com.alibaba.druid.util.StringUtils;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.shop.admin.dao.ShopIngoodsDao;
import com.shop.admin.entity.ShopIngoods;
import com.shop.admin.service.ShopIngoodsService;
import com.shop.admin.utils.PageUtils;
import com.shop.admin.utils.Query;
import org.springframework.stereotype.Service;

import java.util.Map;

@Service
public class ShopIngoodsServiceImpl extends ServiceImpl<ShopIngoodsDao, ShopIngoods> implements ShopIngoodsService {
    @Override
    public PageUtils queryPageData(Map<String, Object> params) {
        QueryWrapper<ShopIngoods> queryWrapper = new QueryWrapper<>();
        String key = (String) params.get("key");
        if (!StringUtils.isEmpty(key)){
            queryWrapper.lambda().eq(ShopIngoods::getIncomingPeople,key);
        }

        IPage<ShopIngoods> page = this.page(
                new Query<ShopIngoods>().getPage(params),
                queryWrapper
        );
        return new PageUtils(page);
    }

}
